﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Gaiocorp.SLMapViewer
{
    public partial class TreeViewLayerGroup : UserControl
    {
        #region Private Properties
        private Color _backroundColor = Colors.White;
        private Color _titleColor = Colors.Black;
        private double _bakOpacity = 1.0;
        #endregion

        #region Public Properties

        /// <summary>
        /// Gets or sets layer visibility
        /// </summary>
        public bool IsChecked
        {
            get { return Convert.ToBoolean(chkBoxGroup.IsChecked); }
            set 
            {
                chkBoxGroup.IsChecked = value;
            }
        }
        /// <summary>
        /// Gets or sets Layer Title
        /// </summary>
        public string GroupName
        {
            get { return tbGroup.Text; }
            set
            {
                tbGroup.Text = value;
            }
        }

        public Color BackroundColor
        {
            get { return _backroundColor; }
            set
            {
                _backroundColor = value;
                this.LayoutRoot.Background = new SolidColorBrush(_backroundColor);
                
            }
        }
        public Color TitleColor
        {
            get { return _titleColor; }
            set
            {
                _titleColor = value;
                this.tbGroup.Foreground = new SolidColorBrush(_titleColor);
            }
        }
        public double BackgroundOpacity
        {
            get { return _bakOpacity; }
            set
            {
                _bakOpacity = value;
                this.LayoutRoot.Opacity = _bakOpacity;
            }
        }
        #endregion
        //TODO Implement event
        //public delegate void Group_Clicked(object sender);
        //public event Group_Clicked Clicked;
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="layerIndex">new layer index</param>
        public TreeViewLayerGroup()
        {
            InitializeComponent();
        }

        
        private void chkBoxGroup_Click(object sender, RoutedEventArgs e)
        {
            if (sender.GetType() == typeof(CheckBox))
            {
               //TODO Implement event
               // Clicked(this);
            }
        }
       
    }
}
